unit AEApplication; interface uses Memory, QuickDraw, Packages, Menus, Events, Fonts, Scrap, ToolUtils,Resources, Errors, Palettes, LowMem, AppleEvents,AEObjects, AERegistry, Errors,globals,Utilities,Edit,File1,file2,Filters, Graphics,Camera, Stacks, PlugIns,macros1,macros2,Analysis,user,lut, Msc, AEInterface, AEUtility, AEWIndow, AEPicture,AEOther; function HandleApplicationEvents(var theAppleEvent, reply:AppleEvent; RefCon:LongInt):OSerr; function ApplicationGetData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; function ApplicationPutData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; var autoname:str255; implementation function HandleApplicationEvents(var theAppleEvent, reply:AppleEvent; RefCon:LongInt):OSerr; VAR pt, lastPt:Point; theError, ignoreErr:OSErr; theLongValue:LongInt; theID:OSType; resultType:DescType; actualSize:Size; macroFSS:FSSpec; theObject:AEDesc; theString, theMacroString: str255; Attributes : str255; LaunchRefNum: integer; FinderInfo: FInfo; oldMacro:Boolean; answer:Boolean; width, height, tick: LongInt; xValue, min, max: extended; xAdd, xMul: extended; i,theShortValue, sStart, sEnd,gain,offset,precision: integer; pic1,pic2: integer; theList:AEDescList; okay: boolean; macroState:Boolean; theEnum:DescType; theEvent: EventRecord; begin theError := AEGetAttributePtr(theAppleEvent,keyEventIDAttr, typeType, resultType, @theID, Sizeof(OSType),actualSize); replyPtr := @reply; macroState := macro; macro := true; if theID = 'GetN' then { REQUEST } begin ignoreErr := GetAEStr255(theAppleEvent, 'mess', theString); xValue := 0; ignoreErr := GetAEEnum(theAppleEvent, keyDirectObject, theEnum); if theEnum = 'Numb' then begin ignoreErr := GetAEExtended(theAppleEvent, 'defV', xValue); ignoreErr := GetAEShort(theAppleEvent, 'prec', precision); if precision < 0 then precision := 0; if precision > 5 then precision := 5; xValue := GetReal(theString, xValue, precision, okay); { if okay then ignoreErr := GetAEExtended(theAppleEvent, 'defV', xValue); } ignoreErr := AEPutParamPtr(reply, keyDirectObject, typeExtended, Ptr(@xValue), sizeof(extended)); end else if theEnum = 'Text' then begin Attributes := ''; ignoreErr := GetAEstr255(theAppleEvent, 'defS', Attributes); theString := GetAString(theString, Attributes); ignoreErr := AEPutParamPtr(reply, keyDirectObject, 'TEXT', Ptr(@theString[1]), length(theString)); end; end else if theID = 'Beep' then { BEEP } begin ignoreErr := GetAEStr255(theAppleEvent, keyDirectObject, theString); PlayBeep(theString); end else if theID = 'CapV' then begin { CAPTURE } theError := GetAEShortFromEnum(theAppleEvent, keyDirectObject, 202, i); case i of 1: StartDigitizing; 2: StopDigitizing 3: begin StartDigitizing; CaptureAndDisplayFrame; StopDigitizing; end 4: CaptureColor 5: begin { Photoshop plug-in } theError := GetAEStr255(theAppleEvent, 'name', theString); if theError = noErr then LoadAcqPlugIn(theString); end; 6,7,8: begin { Average/Integrate/OnChip } ignoreErr := GetAELong(theAppleEvent, 'nFrm', theLongValue); if ignoreErr = noErr then FramesToAverage := theLongValue else FramesToAverage := 10; okay := true; SumFrames := (i = 7); if i = 8 then IntegrateOnChip := true else ignoreErr := GetAEBoolean(theAppleEvent, 'nFrm', VideoRateAveraging); AverageFrames; end; end; end else if theID = 'ClpC' then { CONVERT CLIPBOARD } begin theError := GetAEEnum(theAppleEvent,keyDirectObject,theEnum); if theEnum = 'sys ' then ConvertClipboard else begin ClipboardConverted := true; ConvertSystemClipboard; end end else if theID = 'Enab' then begin { ENABLE } theError := GetAEStr255(theAppleEvent, keyDirectObject, theString); DoSetOptions(theString); end else if theID = 'Macr' then begin { Try loading the macro buffers first } AEMacroAnswer := 0; ignoreErr := AEGetParamPtr(theAppleEvent, 'file', typeFSS, resultType, @macroFSS, SizeOf(macroFSS), actualSize); if (ignoreErr = noErr) then LoadMacrosFromFSSpec(macroFSS) else begin ignoreErr := GetAEStr255(theAppleEvent, 'file', theString); if (ignoreErr = noErr) then begin ignoreErr := GetVol(nil, LaunchRefNum); if ignoreErr = noerr then ignoreErr := GetFInfo(theString, LaunchRefNum, FinderInfo); if ignoreErr = noErr then LoadMacrosFromFile(theString, LaunchRefNum); end end; ignoreErr := AEGetParamDesc(theAppleEvent, 'load', typeChar, theObject); if (ignoreErr = noErr) then with theObject do begin if dataHandle <> nil then LoadMacrosFromMemory(dataHandle^, GetHandleSize(dataHandle)); end; ignoreErr := AEDisposeDesc(theObject); ignoreErr := GetAELong(theAppleEvent, 'numb', theLongValue); if ignoreErr = noErr then begin if (theLongValue < 1) OR (theLongValue > nMacros) then theError := errAEIllegalIndex else RunMacro (theLongValue); end; ignoreErr := GetAEStr255(theAppleEvent, 'name', theString); if (ignoreErr = noErr) then begin theLongValue := FindMenuItem(SpecialMenuH, 9, theString); if (theLongValue <> 0) then RunMacro(theLongValue); end; ignoreErr := GetAEStr255(theAppleEvent, 'run ', theString); if (ignoreErr = noErr) then begin theMacroString := Concat('macro ''LastAE'' ', cr, 'begin', cr); theMacroString := Concat(theMacroString, theString, ';', cr,'end;',cr); LoadMacrosFromMemory(ptr(@theMacroString[1]), ord(theMacroString[0])); RunMacro (1); end; if (theError = noErr) then ignoreErr := AEPutParamPtr(reply, keyDirectObject, typeExtended, Ptr(@AEMacroAnswer), sizeof(extended)); end else if theID = 'GetN' then { MOUSE } begin answer := WaitNextEvent( 0, theEvent, 0, nil ); ignoreErr := GetAEEnum(theAppleEvent, keyDirectObject, theEnum); if theEnum = 'mLoc' then theError := AEPutParamPtr(reply, keyDirectObject, 'QDpt', Ptr(@theEvent.where), sizeof(Point)) else begin if theEnum = 'Down' then answer := Button else if theEnum = 'mOpt' then answer := BAND(theEvent.modifiers, optionKey) <> 0 else if theEnum = 'mSht' then answer := BAND(theEvent.modifiers, shiftKey) <> 0 else if theEnum = 'mCtl' then answer := BAND(theEvent.modifiers, controlKey) <> 0 else if theEnum = 'mCmd' then answer := BAND(theEvent.modifiers, commandKey) <> 0 else if theEnum = 'Appl' then answer := BAND(theEvent.modifiers, commandKey) <> 0; theError := AEPutParamPtr(reply, keyDirectObject, typeBoolean, Ptr(@xValue), sizeof(Boolean)); end; end else if theID = 'Prop' then begin { PROPAGATE } theError := GetAEShortFromEnum(theAppleEvent, keyDirectObject, 204, theShortValue); DoPropagate(theShortValue); end else if theID = 'PXYZ' then PlotXYZ { PLOTXYZ } else if theID = 'ResZ' then begin { RESET } theError := GetAEEnum(theAppleEvent, keyDirectObject, theEnum); if theEnum = 'cntr' then ResetCounter else if theEnum = 'gray' then ResetGrayMap else begin { VIDEO} gain := 255 - (DacHigh - DacLow); offset := DacLow; theError := GetAEShort(theAppleEvent, 'gain', gain); theError := GetAEShort(theAppleEvent, 'offs', offset); SetOffset(offset, gain); SetGain(offset, gain); if VideoControl <> nil then begin gain := 255 - (DacHigh - DacLow); ShowOffsetAndGain(DacLow, gain); end; if (FrameGrabber = ScionLG3) or (FrameGrabber=ScionAG5) or (FrameGrabber=ScionVG5f) then begin DacLowReg^ := DacLow; DacHighReg^ := DacHigh; end; theError := noErr; end end else if theID = 'StaR' then RestoreState { RESTORE STATE } else if theID = 'StaS' then SaveState { STORE STATE } else if theID = 'Tick' then { TICKCOUNT } begin tick := TickCount; ignoreErr := AEPutParamPtr(reply, keyDirectObject, typelongInteger, Ptr(@tick), sizeof(LongInt)); end else if theID = 'Tile' then TileImages { TILE WINDOWS } else if theID = 'undo' then DoUndo { UNDO } else if theID = 'User' then { USER CODE } begin theError := GetAEStr255(theAppleEvent, keyDirectObject, theString); xValue := 0; min := 0; max := 0; ignoreErr := GetAEExtended(theAppleEvent, 'par1', xValue); ignoreErr := GetAEExtended(theAppleEvent, 'par2', min); ignoreErr := GetAEExtended(theAppleEvent, 'par3', max); if theError = noErr then UserMacroCode(theString, xValue, min, max); end else if theID = 'Wait' then { WAIT } begin ignoreErr := GetAEExtended(theAppleEvent, keyDirectObject, xValue); if ignoreErr = noErr then PleaseWait(xValue) else begin ignoreErr := GetAEEnum(theAppleEvent, 'Wfor', theEnum); if ignoreErr = noErr then WaitForTrigger else PleaseWait(1); end; end else if theID = 'PutM' then { PutMessage } begin ignoreErr := GetAEStr255(theAppleEvent, keyDirectObject, theString); PutMessage(theString); end else if theID = 'ShwM' then { ShowMessage } begin ignoreErr := GetAEStr255(theAppleEvent, keyDirectObject, theString); for i := 1 to length(theString) do if theString[i] = '\' then theString[i] := cr; InfoMessage := theString; ShowInfo; end else theError := errAEEventNotHandled; HandleApplicationEvents := theError; replyPtr := nil; macro := macroState; end; function GetMacroVariable(var reply:AppleEvent;inToken: TokenPtr):OSErr; var theError:OSErr; theXValue:extended; symTab:SymTabRec; sp:StackRec; val:integer; answer:Boolean; theString:str255; begin sp := MacrosP^.Stack[inToken^.index]; if sp.vType = IntVar then begin val := trunc(sp.Value); theError := ReturnShortProperty(reply, val); end else if sp.vType = RealVar then begin theXValue := sp.Value; theError := ReturnExtendedProperty(reply, theXValue); end else if sp.vType = BooleanVar then begin answer := sp.Value <> 0; theError := ReturnBooleanProperty(reply, answer); end else if sp.vType = StringVar then begin theString := sp.StringH^^; theError := AEPutParamPtr(reply, keyDirectObject, 'TEXT', Ptr(@theString), length(theString)); end; GetMacroVariable := theError; end; procedure PutMacroVariable(var inAppleEvent:AppleEvent;inToken: TokenPtr); var theError:OSErr; sp:StackRec; theString:str255; theAEProp:AEDesc; begin sp := MacrosP^.Stack[inToken^.index]; with MacrosP^.Stack[inToken^.index] do begin if vType = IntVar then begin Value := GetShortProperty(inAppleEvent, -32000, 32000); end else if vType = RealVar then begin Value := GetExtendedProperty(inAppleEvent); end else if vType = BooleanVar then begin Value := ord(GetBooleanProperty(inAppleEvent)); end else if vType = StringVar then begin theError := AEGetParamDesc(inAppleEvent, 'data', 'TEXT', theAEProp); theError := StringFromDesc(theAEProp, theString); StringH^^ := theString; theError := AEDisposeDesc(theAEProp); end; end; end; function ApplicationGetData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; VAR theError:OSErr; i, theShort, thevalue:integer; theValueL:LongInt; theEnum:LongInt; theValueX:extended; theList:AEDescList; theState : boolean; theName:str255; cl:ClutTable; arrayPtr:AEArrayDataPointer; theWindow:WindowPtr; theToken : AEDesc; theXValue:extended; begin theError := errAEDescNotFound; with inToken^ do begin if name = 'ASiz' then begin theState := AllSameSize; theError := ReturnBooleanProperty(reply,AllSameSize); end else if name = 'nPic' then theError := ReturnShortProperty(reply, nPics) else if name = 'nCor' then theError := ReturnShortProperty(reply, nCoordinates) else if name = 'ptxf' then begin GetFontName(CurrentFontID,theName); theError := AEPutParamPtr(reply, keyDirectObject, 'TEXT', Ptr(@theName[1]), length(theName)); end else if name = 'pAut' then begin theError := AEPutParamPtr(reply, keyDirectObject, 'TEXT', Ptr(@autoname[1]), length(autoname)); theState := true; for i := length(autoname) downto 1 do if theState then begin theState := false; case autoname[i] of '0': autoname[i] := '1' '1': autoname[i] := '2' '2': autoname[i] := '3' '3': autoname[i] := '4' '4': autoname[i] := '5' '5': autoname[i] := '6' '6': autoname[i] := '7' '7': autoname[i] := '8' '8': autoname[i] := '9' '9': begin autoname[i] := '0'; theState := true; end; end; end; end else if name = 'ptps' then theError := ReturnShortProperty(reply, CurrentSize) else if name = 'nWid' then theError := ReturnShortProperty(reply, NewPicWidth) else if name = 'nHit' then theError := ReturnShortProperty(reply, NewPicHeight) else if name = 'pScC' then theError := ReturnBooleanProperty(reply, ScaleConvolutions) else if name = 'pScM' then theError := ReturnBooleanProperty(reply, ScaleArithmetic) else if name = 'pInv' then theError := ReturnBooleanProperty(reply, InvertYCoordinates) else if name = 'Thr-' then begin with info^ do begin if Thresholding then theShort:= ColorStart else if DensitySlicing then theShort:= SliceStart else theShort := 0; end; theError := ReturnShortProperty(reply, theShort); end else if name = 'Thr+' then with info^ do begin if Thresholding then theShort:= 255 else if DensitySlicing then theShort:= SliceEnd else theShort := 0; theError := ReturnShortProperty(reply, theShort); end else if name = 'nBin' then theError := ReturnShortProperty(reply, BinaryCount) else if name = 'LabP' then theError := ReturnBooleanProperty(reply,LabelParticles) else if name = 'OutP' then theError := ReturnBooleanProperty(reply,OutlineParticles) else if name = 'IgnP' then theError := ReturnBooleanProperty(reply,IgnoreParticlesTouchingEdge) else if name = 'IncP' then theError := ReturnBooleanProperty(reply,IncludeHoles) else if name = 'MinP' then theError := ReturnLongProperty(reply,MinParticleSize) else if name = 'MaxP' then theError := ReturnLongProperty(reply,MaxParticleSize) else if name = 'RedS' then theError := ReturnBooleanProperty(reply,RedirectSampling) else if name = 'Wand' then theError := ReturnBooleanProperty(reply,WandAutoMeasure) else if name = 'AdjA' then theError := ReturnBooleanProperty(reply, WandAdjustAreas) else if name = 'nDig' then theError := ReturnShortProperty(reply, FieldWidth) else if name = 'nNDP' then theError := ReturnShortProperty(reply, precision) else if name = 'VidC' then theError := ReturnShortProperty(reply, VideoChannel+1) else if name = 'VidI' then theError := ReturnBooleanProperty(reply, InvertVideo) else if name = 'VidH' then theError := ReturnBooleanProperty(reply, HighlightSaturatedPixels) else if name = 'VidT' then theError := ReturnBooleanProperty(reply, ExternalTrigger) else if name = 'VidS' then theError := ReturnBooleanProperty(reply, SyncMode = SeparateSync) else if name = 'VidO' then theError := ReturnBooleanProperty(reply, OscillatingMovies) else if name = 'VidB' then theError := ReturnBooleanProperty(reply, BlindMovieCapture) else if name = 'VidP' then theError := ReturnBooleanProperty(reply, false) {Variable Not Available?} else if name = 'pVer' then theError := ReturnExtendedProperty(reply, version * 0.01) else if name = 'UDSz' then theError := ReturnLongProperty(reply, UndoBufSize) else if name = 'uAvg' then begin CheckIndex(index,1,nStandards); if thru > 0 then begin theError := AECreateList(nil, 0,false,theList); CheckIndex(thru,1,nStandards); for i := index to thru do theError := AEPutPtr( theList, 0, typeExtended, Ptr(@umean[i]), sizeof(extended) ); theError := AEPutParamDesc( reply, keyDirectObject, theList ); end else theError := ReturnExtendedProperty(reply, umean[index]); end else if name = 'Stds' then begin CheckIndex(index,1,nStandards); if thru > 0 then begin theError := AECreateList(nil, 0,false,theList); CheckIndex(thru,1,nStandards); for i := index to thru do theError := AEPutPtr( theList, 0, typeExtended, Ptr(@StandardValues[i]), sizeof(extended) ); theError := AEPutParamDesc( reply, keyDirectObject, theList ); end else theError := ReturnExtendedProperty(reply, StandardValues[index]); end else if name = 'cVal' then begin CheckIndex(index,0,255); if thru > 0 then begin theError := AECreateList(nil, 0,false,theList); CheckIndex(thru,0,255); for i := index to thru do theError := AEPutPtr( theList, 0, typeExtended, Ptr(@cValue[i]), sizeof(extended) ); theError := AEPutParamDesc( reply, keyDirectObject, theList ); end else theError := ReturnExtendedProperty(reply, cValue[index]); end else if name = 'rLG3' then begin case index of 1: theValue := LG3DacA; 2: theValue := LG3DacB; 3: theValue := ControlReg^; 4: theValue := LG3DataOut; end; theError := ReturnShortProperty(reply, theValue); end else if name = 'xCor' then begin if thru > 0 then begin theError := AECreateList(nil, 0,false,theList); CheckIndex(thru,1,MaxLine); for i := index to thru do begin theXValue := xCoordinates^[i]; if info^.SpatiallyCalibrated then theXValue := theXValue / info^.xScale; theError := AEPutPtr( theList, 0, typeExtended, Ptr(@theXValue), sizeof(extended) ); end; theError := AEPutParamDesc( reply, keyDirectObject, theList ); end else begin theXValue := xCoordinates^[index]; if info^.SpatiallyCalibrated then theXValue := theXValue / info^.xScale; theError := ReturnExtendedProperty(reply, theXValue); end; end else if name = 'yCor' then begin if thru > 0 then begin theError := AECreateList(nil, 0,false,theList); CheckIndex(thru,1,MaxLine); for i := index to thru do begin theXValue := yCoordinates^[i]; if info^.SpatiallyCalibrated then theXValue := theXValue / info^.yScale; theError := AEPutPtr( theList, 0, typeExtended, Ptr(@theXValue), sizeof(extended) ); end; theError := AEPutParamDesc( reply, keyDirectObject, theList ); end else begin theXValue := yCoordinates^[index]; if info^.SpatiallyCalibrated then theXValue := theXValue / info^.yScale; theError := ReturnExtendedProperty(reply, theXValue); end; end else if name = 'Ivar' then theError := GetMacroVariable(reply, inToken) else begin { not found, so try submodels } if CurrentWPtr <> nil then begin containerWindow := CurrentWPtr; containerInfo := info; if CurrentWindow = PicKind then theError := PictureGetData(inAppleEvent, reply, inToken) else theError := WindowGetData(inAppleEvent, reply, inToken); end else begin if info <> NoInfo then begin containerWindow := info^.wptr; containerInfo := info; end; theError := PictureGetData(inAppleEvent, reply, inToken); end; containerWindow := nil; containerInfo := NoInfo; if theError <> noErr then theError := ResultsGetData(inAppleEvent, reply, inToken); end end; ApplicationGetData := theError; end; procedure SetOption (id: integer; var option: boolean; enable: boolean); {Updates the modeless Video Control dialog box.} begin if option <> enable then DoVideoControl(id) end; function ApplicationPutData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; VAR i,theValue,n:integer; theError, ignoreErr:OSErr; theName:str255; theAEProp: AEDesc; theList:AEDescList; answer:Boolean; theXVal,theXValue:extended; itemsInList:LongInt; theReturnedType:DescType; theActualSize:Size; typeCode:DescType; NewSyncMode: SyncModeType; begin theError := noErr; with inToken^ do begin if name = 'ptxf' then begin theError := AEGetParamDesc(inAppleEvent, 'data', 'TEXT', theAEProp); theError := StringFromDesc(theAEProp, theName); GetFNum(theName,theValue); if theValue <> 0 then CurrentFontID := theValue; ignoreErr := AEDisposeDesc(theAEProp); end else if name = 'ptps' then CurrentSize := GetShortProperty(inAppleEvent,6,720) else if name = 'txst' then begin theError := AEGetParamDesc(inAppleEvent, 'data', 'TEXT', theAEProp); theError := StringFromDesc(theAEProp, theName); SetTextStyle(theName); ignoreErr := AEDisposeDesc(theAEProp); end else if name = 'pAut' then begin theError := AEGetParamDesc(inAppleEvent, 'data', 'TEXT', theAEProp); theError := StringFromDesc(theAEProp, autoname); ignoreErr := AEDisposeDesc(theAEProp); end else if name = 'nWid' then NewPicWidth := GetShortProperty(inAppleEvent,6,720) else if name = 'nHit' then NewPicHeight := GetShortProperty(inAppleEvent,6,720) else if name = 'pScC' then ScaleConvolutions := GetBooleanProperty(inAppleEvent) else if name = 'pScM' then ScaleArithmetic := GetBooleanProperty(inAppleEvent) else if name = 'nBin' then begin theError := AEGetParamDesc(inAppleEvent, 'data', typeShortInteger, theAEProp); theError := ShortFromDesc(theAEProp, theValue); if (theValue < 1) or (theValue > 8) then ApplicationPutData := errAEDescNotFound else begin BinaryCount := theValue; BinaryThreshold := BinaryCount * 255; end; ignoreErr := AEDisposeDesc(theAEProp); end else if name = 'LabP' then LabelParticles:= GetBooleanProperty(inAppleEvent) else if name = 'OutP' then OutlineParticles := GetBooleanProperty(inAppleEvent) else if name = 'IgnP' then IgnoreParticlesTouchingEdge := GetBooleanProperty(inAppleEvent) else if name = 'IncP' then IncludeHoles := GetBooleanProperty(inAppleEvent) else if name = 'MinP' then MinParticleSize := GetLongProperty(inAppleEvent) else if name = 'MaxP' then MaxParticleSize := GetLongProperty(inAppleEvent) else if name = 'RedS' then RedirectSampling := GetBooleanProperty(inAppleEvent) else if name = 'Wand' then WandAutoMeasure := GetBooleanProperty(inAppleEvent) else if name = 'AdjA' then WandAdjustAreas := GetBooleanProperty(inAppleEvent) else if name = 'nDig' then FieldWidth := GetShortProperty(inAppleEvent,1,18) else if name = 'nNDP' then precision := GetShortProperty(inAppleEvent,0,12) else if name = 'VidC' then begin theValue := GetEnumProperty(inAppleEvent,203); if theValue <> 0 then DoVideoControl(FirstChannelID + theValue - 1); end else if name = 'pInv' then InvertYCoordinates := GetBooleanProperty(inAppleEvent) else if name = 'VidI' then SetOption(InvertID, InvertVideo, GetBooleanProperty(inAppleEvent)) else if name = 'VidH' then SetOption(HighlightID, HighlightSaturatedPixels, GetBooleanProperty(inAppleEvent)) else if name = 'VidT' then SetOption(TriggerID, ExternalTrigger, GetBooleanProperty(inAppleEvent)) else if name = 'VidS' then begin if GetBooleanProperty(inAppleEvent) then NewSyncMode := SeparateSync else NewSyncMode := NormalSync; if NewSyncMode <> SyncMode then DoVideoControl(SyncID); end else if name = 'VidO' then OscillatingMovies := GetBooleanProperty(inAppleEvent) else if name = 'VidB' then BlindMovieCapture := GetBooleanProperty(inAppleEvent) else if name = 'VidP' then begin answer := GetBooleanProperty(inAppleEvent); if answer then begin EraseScreen; UpdatePicWindow; end else RestoreScreen; end else if name = 'uAvg' then begin theError := AEGetParamDesc(inAppleEvent, keyDirectObject, typeAEList, theList); theError := AECountItems(theList, itemsInList); CheckIndex(index, 1, nStandards); CheckIndex(thru, 1, nStandards); n := 1; for i := index to thru do begin theError := AEGetNthPtr( theList, n, typeExtended, typeCode, theReturnedType, Ptr(@umean[i]), Sizeof(extended), theActualSize ); if i > nStandards then nStandards := i; n := n + 1; end; ignoreErr := AEDisposeDesc(theList); end else if name = 'Stds' then begin theError := AEGetParamDesc(inAppleEvent, keyDirectObject, typeAEList, theList); theError := AECountItems(theList, itemsInList); CheckIndex(index, 1, nStandards); CheckIndex(thru, 1, nStandards); n := 1; for i := index to thru do begin theError := AEGetNthPtr( theList, n, typeExtended, typeCode, theReturnedType, Ptr(@StandardValues[i]), Sizeof(extended), theActualSize ); if i > nStandards then nStandards := i; n := n + 1; end; ignoreErr := AEDisposeDesc(theList); end else if name = 'cVal' then begin theError := AEGetParamDesc(inAppleEvent, keyDirectObject, typeAEList, theList); theError := AECountItems(theList, itemsInList); CheckIndex(index, 0,255); CheckIndex(thru, 0,255); n := 1; for i := index to thru do begin theError := AEGetNthPtr( theList, n, typeExtended, typeCode, theReturnedType, Ptr(@cValue[i]), Sizeof(extended), theActualSize ); n := n + 1; end; ignoreErr := AEDisposeDesc(theList); end else if name = 'xCor' then begin theError := AEGetParamDesc(inAppleEvent, keyDirectObject, typeAEList, theList); theError := AECountItems(theList, itemsInList); CheckIndex(index,1,MaxLine); CheckIndex(thru, 1,MaxLine); n := 1; for i := index to thru do with info^ do begin theError := AEGetNthPtr( theList, n, typeExtended, typeCode, theReturnedType, Ptr(@theXValue), Sizeof(extended), theActualSize ); if SpatiallyCalibrated then theXValue := theXValue * xScale; xCoordinates^[index] := trunc(theXValue); n := n + 1; end; ignoreErr := AEDisposeDesc(theList); end else if name = 'yCor' then begin theError := AEGetParamDesc(inAppleEvent, keyDirectObject, typeAEList, theList); theError := AECountItems(theList, itemsInList); CheckIndex(index,1,MaxLine); CheckIndex(thru, 1,MaxLine); n := 1; for i := index to thru do with info^ do begin theError := AEGetNthPtr( theList, n, typeExtended, typeCode, theReturnedType, Ptr(@theXValue), Sizeof(extended), theActualSize ); if SpatiallyCalibrated then theXValue := theXValue * yScale; yCoordinates^[index] := trunc(theXValue); n := n + 1; end; ignoreErr := AEDisposeDesc(theList); end else if name = 'rLG3' then begin theValue := GetShortProperty(inAppleEvent,0,255); case index of 1: begin LG3DacA := theValue; DacAReg^ := LG3DacA end; 2: begin LG3DacB := theValue; DacBReg^ := LG3DacB end; { 3: DataIn is read-only } 4: begin LG3DataOut := band(theValue, $f); if SyncMode = SeparateSync then theValue := 3 else theValue := VideoChannel; ChannelReg^ := bor(LG3DataOut, bor(bsl(VideoChannel, 4), bsl(theValue, 6))); end; end; end else if name = 'Ivar' then PutMacroVariable(inAppleEvent, inToken) else begin { not found, so try submodels } if CurrentWPtr <> nil then begin if CurrentKind = PicKind then begin containerWindow := CurrentWPtr; containerInfo := info; end; theError := PicturePutData(inAppleEvent, reply, inToken) end; containerInfo := NoInfo; containerWindow := nil; if theError <> noErr then theError := ResultsPutData(inAppleEvent, reply, inToken); end end; ApplicationPutData := theError; end; end.